// haxzs audio server
// made by omghaxzs
// 2011

#ifndef CLIENT_MANAGER_H
#define CLIENT_MANAGER_H

#include <hap.h>
#include <boost/thread.hpp>
#include <vector>

class client_manager {
public:

    bool started;

    client_manager(boost::asio::io_service*, int, int);
    
    void start();
    
    bool listenForClients();
    bool processClients();
    bool diagnoseClients();


    // Getters
    inline std::vector<hap::client*> getClients() { return this->clients; }

private:
    // Some of our private members...
    // We need to have a vector containing all of our clients
    std::vector<hap::client*> clients;
    
    // Save a spot for the source as well
    hap::source source;
    
    // We need to have a thread pool, in addition to three primary threads
    std::vector<boost::shared_ptr<boost::thread> > threadPool;
    
    // The three primary threads, listening, processing, and diagnosing
    boost::shared_ptr<boost::thread> m_ListeningThread, m_ProcessingThread, m_DiagnosticThread;
};

#endif
